package com.sptpc.mall;

import com.sptpc.mall.model.Category;
import com.sptpc.mall.service.CategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@Slf4j
@SpringBootApplication
public class MallApplication  implements ApplicationRunner {
    @Autowired
    private CategoryService categoryService;

    public static void main(String[] args) {
        SpringApplication.run(MallApplication.class, args);
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        Category category = categoryService.saveCategory("笔记本");
        log.info("新分类: {}",category);
    }
}
